/// <license>
/// Copyright (c) 2002-2008, DotNetNuke Corporation
/// All rights reserved
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
/// documentation files (the "Software"), to deal in the Software without restriction, including without limitation 
/// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and 
/// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in all copies or substantial portions 
/// of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 
/// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
/// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 
/// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
/// DEALINGS IN THE SOFTWARE.
/// </license>

#region Using Statements

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Text;
using System.Xml.Serialization;

using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Modules;
using DotNetNuke.UI.WebControls;

#endregion

namespace DotNetNuke.ModuleToolkit.Modules.Extensions
{
    /// -----------------------------------------------------------------------------
    /// <summary>
    /// The ExtensionInfo Class provides the Extension Business Object
    /// </summary>
    /// <history>
    /// 	[cnurse]	10/11/2007	Created
    /// </history>
    /// -----------------------------------------------------------------------------
    public class ExtensionInfo : IHydratable
    {

        #region Private Members

        private int _ExtensionId = Null.NullInteger;
        private int _PackageId = Null.NullInteger;
        private int _DesktopModuleId = Null.NullInteger;
        private string _Name = Null.NullString;
        private string _IExtensionClass = Null.NullString;

        #endregion

        #region Public Properties

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets and sets the Id of the Desktop Module
        /// </summary>
        /// <history>
        /// 	[cnurse]	10/11/2007	Created
        /// </history>
        /// -----------------------------------------------------------------------------        
        [Browsable(false)]
        public int DesktopModuleId
        {
            get { return _DesktopModuleId; }
            set { _DesktopModuleId = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets and sets the Name of the Extension
        /// </summary>
        /// <history>
        /// 	[cnurse]	01/31/2006	Created
        /// </history>
        /// -----------------------------------------------------------------------------        
        [Browsable(false)]
        public string Name
        {
            get { return _Name; }
            set { _Name = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets and sets the Id of the Package
        /// </summary>
        /// <history>
        /// 	[cnurse]	10/13/2007	Created
        /// </history>
        /// -----------------------------------------------------------------------------        
        [Browsable(false)]
        public int PackageId
        {
            get { return _PackageId; }
            set { _PackageId = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets and sets the Id of the Section
        /// </summary>
        /// <history>
        /// 	[cnurse]	10/11/2007	Created
        /// </history>
        /// -----------------------------------------------------------------------------        
        [Browsable(false)]
        public int ExtensionId
        {
            get { return _ExtensionId; }
            set { _ExtensionId = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets and sets the Base class for the Extension
        /// </summary>
        /// <history>
        /// 	[cnurse]	10/11/2007	Created
        /// </history>
        /// -----------------------------------------------------------------------------        
        [Browsable(false)]
        public string IExtensionClass
        {
            get { return _IExtensionClass; }
            set { _IExtensionClass = value; }
        }


        #endregion

        #region IHydratable Members

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets and sets the KeyID of the Extension
        /// </summary>
        /// <remarks>The KeyID is the unique identifier, used by the CBO class to build
        /// a Dictionary of Extensions</remarks>
        /// <history>
        /// 	[cnurse]	10/11/2007	Created
        /// </history>
        /// -----------------------------------------------------------------------------
        [Browsable(false), XmlIgnore()]
        public int KeyID
        {
            get { return ExtensionId; }
            set { ExtensionId = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Hydrates a Extension from a DataReader representing the Extension
        /// </summary>
        /// <param name="source">The Data Reader containing the values to use to fill the Extension.</param>
        /// <history>
        /// 	[cnurse]	10/11/2007	Created
        /// </history>
        /// -----------------------------------------------------------------------------
        public void Fill(IDataReader source)
        {
            ExtensionId = Convert.ToInt32(Null.SetNull(source["ExtensionID"], ExtensionId));
            PackageId = Convert.ToInt32(Null.SetNull(source["PackageID"], PackageId));
            DesktopModuleId = Convert.ToInt32(Null.SetNull(source["DesktopModuleID"], DesktopModuleId));
            Name = Convert.ToString(Null.SetNull(source["ExtensionName"], Name));
            IExtensionClass = Convert.ToString(Null.SetNull(source["IExtensionClass"], IExtensionClass));
        }

        #endregion

    }
}
